package org.yunmai.controller;


import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.yunmai.dto.LoginDto;
import org.yunmai.service.IuserService;
import org.yunmai.util.R;
import org.yunmai.vo.LoginVo;


/**
 * 用户登陆功能模块
 *
 * @author 小灰灰
 */
@RestController
@RequestMapping("/login")
@Tag(name = "用户登陆功能模块")
public class LoginController {


    IuserService userService;

    @Autowired
    public void getUserService(IuserService userService) {
        this.userService = userService;
    }

    @PostMapping("/login")
    @Operation(summary = "用户登陆")
    public R<LoginVo> login(
            @RequestBody LoginDto login
    ) {
        return userService.login(login);
    }

    /**
     *
     * @return
     */
    @GetMapping("/list")
    public R<String> list(
            @RequestParam(value = "page",defaultValue = "1") Integer page,
            @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize

    ){

        return userService.listPage(page,pageSize);
    }

}
